(0) Obligation:
Runtime Complexity TRS:
The TRS R consists of the following rules:
prime(0) → false
prime(s(0)) → false
prime(s(s(x))) → prime1(s(s(x)), s(x))
prime1(x, 0) → false
prime1(x, s(0)) → true
prime1(x, s(s(y))) → and(not(divp(s(s(y)), x)), prime1(x, s(y)))
divp(x, y) → =(rem(x, y), 0)
Rewrite Strategy: INNERMOST
(1) RenamingProof (EQUIVALENT transformation)
Renamed function symbols to avoid clashes with predefined symbol.
(2) Obligation:
Runtime Complexity Relative TRS:
The TRS R consists of the following rules:
prime(0') → false
prime(s(0')) → false
prime(s(s(x))) → prime1(s(s(x)), s(x))
prime1(x, 0') → false
prime1(x, s(0')) → true
prime1(x, s(s(y))) → and(not(divp(s(s(y)), x)), prime1(x, s(y)))
divp(x, y) → ='(rem(x, y), 0')
S is empty.
Rewrite Strategy: INNERMOST
(3) SlicingProof (LOWER BOUND(ID) transformation)
Sliced the following arguments:
prime1/0
divp/0
divp/1
='/0
='/1
rem/0
rem/1
(4) Obligation:
Runtime Complexity Relative TRS:
The TRS R consists of the following rules:
prime(0') → false
prime(s(0')) → false
prime(s(s(x))) → prime1(s(x))
prime1(0') → false
prime1(s(0')) → true
prime1(s(s(y))) → and(not(divp), prime1(s(y)))
divp → ='
S is empty.
Rewrite Strategy: INNERMOST
(5) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)
Infered types.
(6) Obligation:
Innermost TRS:
Rules:
prime(0') → false
prime(s(0')) → false
prime(s(s(x))) → prime1(s(x))
prime1(0') → false
prime1(s(0')) → true
prime1(s(s(y))) → and(not(divp), prime1(s(y)))
divp → ='
Types:
prime :: 0':s → false:true:and
0' :: 0':s
false :: false:true:and
s :: 0':s → 0':s
prime1 :: 0':s → false:true:and
true :: false:true:and
and :: not → false:true:and → false:true:and
not :: =' → not
divp :: ='
=' :: ='
hole_false:true:and1_0 :: false:true:and
hole_0':s2_0 :: 0':s
hole_not3_0 :: not
hole_='4_0 :: ='
gen_false:true:and5_0 :: Nat → false:true:and
gen_0':s6_0 :: Nat → 0':s
(7) OrderProof (LOWER BOUND(ID) transformation)
Heuristically decided to analyse the following defined symbols:
prime1
(8) Obligation:
Innermost TRS:
Rules:
prime(
0') →
falseprime(
s(
0')) →
falseprime(
s(
s(
x))) →
prime1(
s(
x))
prime1(
0') →
falseprime1(
s(
0')) →
trueprime1(
s(
s(
y))) →
and(
not(
divp),
prime1(
s(
y)))
divp →
='Types:
prime :: 0':s → false:true:and
0' :: 0':s
false :: false:true:and
s :: 0':s → 0':s
prime1 :: 0':s → false:true:and
true :: false:true:and
and :: not → false:true:and → false:true:and
not :: =' → not
divp :: ='
=' :: ='
hole_false:true:and1_0 :: false:true:and
hole_0':s2_0 :: 0':s
hole_not3_0 :: not
hole_='4_0 :: ='
gen_false:true:and5_0 :: Nat → false:true:and
gen_0':s6_0 :: Nat → 0':s
Generator Equations:
gen_false:true:and5_0(0) ⇔ false
gen_false:true:and5_0(+(x, 1)) ⇔ and(not(='), gen_false:true:and5_0(x))
gen_0':s6_0(0) ⇔ 0'
gen_0':s6_0(+(x, 1)) ⇔ s(gen_0':s6_0(x))
The following defined symbols remain to be analysed:
prime1
(9) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
prime1(
gen_0':s6_0(
+(
1,
n8_0))) →
*7_0, rt ∈ Ω(n8
0)
Induction Base:
prime1(gen_0':s6_0(+(1, 0)))
Induction Step:
prime1(gen_0':s6_0(+(1, +(n8_0, 1)))) →RΩ(1)
and(not(divp), prime1(s(gen_0':s6_0(n8_0)))) →RΩ(1)
and(not(='), prime1(s(gen_0':s6_0(n8_0)))) →IH
and(not(='), *7_0)
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(10) Complex Obligation (BEST)
(11) Obligation:
Innermost TRS:
Rules:
prime(
0') →
falseprime(
s(
0')) →
falseprime(
s(
s(
x))) →
prime1(
s(
x))
prime1(
0') →
falseprime1(
s(
0')) →
trueprime1(
s(
s(
y))) →
and(
not(
divp),
prime1(
s(
y)))
divp →
='Types:
prime :: 0':s → false:true:and
0' :: 0':s
false :: false:true:and
s :: 0':s → 0':s
prime1 :: 0':s → false:true:and
true :: false:true:and
and :: not → false:true:and → false:true:and
not :: =' → not
divp :: ='
=' :: ='
hole_false:true:and1_0 :: false:true:and
hole_0':s2_0 :: 0':s
hole_not3_0 :: not
hole_='4_0 :: ='
gen_false:true:and5_0 :: Nat → false:true:and
gen_0':s6_0 :: Nat → 0':s
Lemmas:
prime1(gen_0':s6_0(+(1, n8_0))) → *7_0, rt ∈ Ω(n80)
Generator Equations:
gen_false:true:and5_0(0) ⇔ false
gen_false:true:and5_0(+(x, 1)) ⇔ and(not(='), gen_false:true:and5_0(x))
gen_0':s6_0(0) ⇔ 0'
gen_0':s6_0(+(x, 1)) ⇔ s(gen_0':s6_0(x))
No more defined symbols left to analyse.
(12) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
prime1(gen_0':s6_0(+(1, n8_0))) → *7_0, rt ∈ Ω(n80)
(13) BOUNDS(n^1, INF)
(14) Obligation:
Innermost TRS:
Rules:
prime(
0') →
falseprime(
s(
0')) →
falseprime(
s(
s(
x))) →
prime1(
s(
x))
prime1(
0') →
falseprime1(
s(
0')) →
trueprime1(
s(
s(
y))) →
and(
not(
divp),
prime1(
s(
y)))
divp →
='Types:
prime :: 0':s → false:true:and
0' :: 0':s
false :: false:true:and
s :: 0':s → 0':s
prime1 :: 0':s → false:true:and
true :: false:true:and
and :: not → false:true:and → false:true:and
not :: =' → not
divp :: ='
=' :: ='
hole_false:true:and1_0 :: false:true:and
hole_0':s2_0 :: 0':s
hole_not3_0 :: not
hole_='4_0 :: ='
gen_false:true:and5_0 :: Nat → false:true:and
gen_0':s6_0 :: Nat → 0':s
Lemmas:
prime1(gen_0':s6_0(+(1, n8_0))) → *7_0, rt ∈ Ω(n80)
Generator Equations:
gen_false:true:and5_0(0) ⇔ false
gen_false:true:and5_0(+(x, 1)) ⇔ and(not(='), gen_false:true:and5_0(x))
gen_0':s6_0(0) ⇔ 0'
gen_0':s6_0(+(x, 1)) ⇔ s(gen_0':s6_0(x))
No more defined symbols left to analyse.
(15) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
prime1(gen_0':s6_0(+(1, n8_0))) → *7_0, rt ∈ Ω(n80)
(16) BOUNDS(n^1, INF)